﻿using System;
using System.Configuration;

namespace Catalyst.Configuration
{
	public class EnumTableElementCollection : SpecializedTableElementCollection<EnumTableElement, EnumTableElementCollection>
	{
		public EnumTableElement this[int index]
		{
			get
			{
				return (EnumTableElement)BaseGet(index);
			}
			set
			{
				if (BaseGet(index) != null)
				{
					BaseRemoveAt(index);
				}

				BaseAdd(index, value);
			}
		}
	}

	public class EnumTableElement : SpecializedTableElement<EnumTableElement>
	{
		[ConfigurationProperty("dataKeyField", IsRequired = true)]
		public string DataKeyField
		{
			get { return this["dataKeyField"].ToString(); }
		}

		[ConfigurationProperty("dataValueField", IsRequired = true)]
		public string DataValueField
		{
			get { return this["dataValueField"].ToString(); }
		}
	}
}
